package cn.itsource.org.mapper;

import cn.itsource.org.domain.TShop;
import cn.itsource.org.query.ShopQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface ShopMapper extends Mapper<TShop> {

    //分页查询
    List<TShop> findPageByParam(ShopQuery query);

    //分页查询符合条件的总数量
    Long findPageByParamCount(ShopQuery query);

    void save(TShop shop);

    int checkNameIsExits(String name);

    //可以通过注解方式，执行sql语句（前提：参数的数量是固定的，且必传）
    @Update("update t_shop set state = #{state} where id = #{id}")
    void updateStateById(@Param("id") Long id, @Param("state") Integer state);

    @Select("select * from t_shop where id = #{id}")
    TShop findShopById(Long id);
}
